import { boot } from 'quasar/wrappers';
import { GlobalStore } from '@/stores';
const globalStore = GlobalStore();

export default boot(({ app }) => {
  app.directive('permission', {
    mounted(el: any, binding: any, vnode: any) {
      // router.beforeEach((to: any, from: any, next: any) => {
      //   console.log(to.fullPath);
      //   next();
      // });
      let status = false;
      globalStore.permissions.forEach((item: any) => {
        if (item == binding.value) {
          status = true;
        }
      });
      if (!status) {
        el.style.display = 'none';
      }
    },
  });
});
